using Microsoft.EntityFrameworkCore;

using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

using Tool;

namespace Abc.Core.Entities
{
    /// <summary>
    /// 短信发送记录
    /// </summary>
    [Table("SmsSend")]
    [Comment("短信发送记录")]
    public class SmsSend : FullEntity
    {
        /// <summary>
        /// 类型代码（比如验证码、支付）
        /// </summary>
        public string TypeCode { get; set; }

        /// <summary>
        /// 内容
        /// </summary>
        [Comment("内容")]
        [MaxLength(500)]
        public string Content { get; set; }

        /// <summary>
        /// 接收号码
        /// </summary>
        [Comment("接收号码")]
        [MaxLength(11)]
        public string Receive { get; set; }

        /// <summary>
        /// 接收用户名称
        /// </summary>
        [Comment("接收用户名称")]
        public string ReceiveName { get; set; }

        /// <summary>
        /// 发送状态
        /// </summary>
        [Comment("发送状态(待发送 = 0,发送成功 = 1,发送失败 = 2)")]
        public SmsSendRecordState State { get; set; }

        /// <summary>
        /// 过期时间
        /// </summary>
        [Comment("过期时间")]
        public DateTimeOffset ExpireTime { get; set; }

        /// <summary>
        /// 是否使用
        /// </summary>
        [Comment("是否使用")]
        public bool IsUse { get; set; }

        /// <summary>
        /// 使用时间
        /// </summary>
        [Comment("使用时间")]
        public DateTimeOffset UseTime { get; set; }

        /// <summary>
        /// 来源ID
        /// </summary>
        [Comment("来源ID")]
        public int? SourceId { get; set; }
    }

    public enum SmsSendRecordState
    {
        待发送 = 0,
        发送成功 = 1,
        发送失败
    }
}